home *** CD-ROM | disk | FTP | other *** search
- Path: netnews1.apci.com!usenet
- From: wardmw@apci.com (Martin Ward)
- Newsgroups: comp.lang.c,comp.lang.c++,comp.lang.perl
- Subject: Re: Stupid array problems
- Date: Mon, 15 Jan 1996 08:08:37 GMT
- Organization: Air Products Europe
- Message-ID: <4dd2ad$3hp@netnews1.apci.com>
- References: <4d9b9v$14n@paperboy.ids.net>
- Reply-To: wardmw@apci.com
- NNTP-Posting-Host: p1862.apci.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- Hi Seth,
-
- Two answers spring to mind.
-
- 1) If your array is large and fixed in size, you could set the array element to
- NULL when you free() it. Then when you loop through the array looking at
- elements you simply test for (elem == NULL) first.
-
- 2) If your array is small and fixed in sized, you could simply shuffle all the
- elements after the freed one up to fill the space you've just emptied.
-
- 3) (The most complicated one, but not too difficult) you could implement the
- whole array as a liked list. The when you delete an element, you simply repoint
- the prevous element to the next one.
-
- HTH.
-
- |\/|
-
-